package ifosup.matthias.runnable;

import java.util.*;

public class ConsommateurMessage implements Runnable
{
	private List<String> list = new ArrayList<String>();
	synchronized public void envoi(String s)
	{
		list.add(s);
		System.out.println(s);
		notify();
	}
	
	public void run()
	{
		while(true)
		{
			if(!list.isEmpty())
			{
				String b = list.remove(0);
				attente();
				System.out.println(b+" !!!!!!!!");
			}
			
		}
	}
	
	synchronized public void attente()
	{
		try {
			wait(5000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
}
